import React, { Component } from "react";
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
import "./omsDatePicker.css";
export default class OmsDate extends Component {
  constructor(props) {
    super(props);
    this.state = {
      startDate: null
    };
    this.handleChange = this.handleChange.bind(this);
  }

  handleChange(date) {
    this.setState({
      startDate: date
    });
  }
  
  render() {
    var _this = this,
       dataConfig = _this.props.dataConfig;
    return (
      <DatePicker
        selected={_this.state.startDate}
        onChange={_this.handleChange}
        dateFormat="yyyy-MM-d"
        className="form-control"
        showYearDropdown
        placeholderText={dataConfig?dataConfig.placeholderText:'请选择时间'}
        useWeekdaysShort
        name={dataConfig?dataConfig.name:'data[]'}
         />
    );
  }
}